package com.makinolo.rlvforge.tacx.data
{
	import flash.utils.ByteArray;
	
public class Header implements Persistent
{	
	public static const PGMF_FINGERPRINT:int = 1000; // Catalyst Program (.pgfm) 
	public static const RLV_FINGERPRINT:int = 2000; // RLV (.rlv)
	public static const CAF_FINGERPRINT:int = 3000;  // Catalyst Workout (.caf)  
	public static const IMF_FINGERPRINT:int = 4000; //VR Workout (.imf)
	
	private var FileFingerprint:int;// (Unsigned Short) 1000 = Catalyst Program (.pgmf), 2000 = RLV (.rlv), 3000 = Catalyst Workout (.caf), 4000 = VR Workout (.imf)
	private var FileVersion:int; 	// (Unsigned Short) A 3 digit number indicating the file version, e.g. 100 or 110
	private var BlockCount:int; 	// Number of blocks in the file
	
	public function Header(ff:int, fv:int, bc:int)   
	{
		FileFingerprint = ff;		
		FileVersion = fv;
		BlockCount = bc;
	}

	public function getBlockCount():int
	{
		return BlockCount;
	}

	public function setBlockCount(blockCount:int):void
	{
		BlockCount = blockCount;
	}

	public function getFileFingerprint():int
	{
		return FileFingerprint;
	}

	public function setFileFingerprint(fileFingerprint:int):void
	{
		FileFingerprint = fileFingerprint;
	}

	public function getFileVersion():int
	{
		return FileVersion;
	}

	public  function setFileVersion(fileVersion:int):void
	{
		FileVersion = fileVersion;
	}
	
	public function persist(dos:ByteArray):void
	{		
		dos.writeShort(getFileFingerprint());
		dos.writeShort(getFileVersion());
		dos.writeInt(getBlockCount());
	}
	
}

}